package com.itqf.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.itqf.entity.Book;
import com.itqf.service.BookService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @Description:
 * @Company: 千锋互联
 * @Author: 李丽婷
 * @Date: 2020/12/22
 * @Time: 下午4:12
 */
@Controller
//@RestController
public class BookController {
//
//    @Resource
//    private BookService bookService;

    @Reference(version = "2.0")//
    private BookService bookService;


    @RequestMapping("/find")
    @ResponseBody
    public List<Book> find(){
             System.out.println(bookService);
            return  bookService.findAll();
    }

    @RequestMapping("/findById/{id}")
    @ResponseBody
    public Book find(@PathVariable  int id){
            return  bookService.findById(id);
    }


}
